package com.qm.console.component.util;

import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;

/**
 * @author fangzhipeng
 * @date 2018/1/24
 */
public class ResourceUtil {

    private static ThreadLocal<ResourceLoader> resourceLoaderThreadLocal = new ThreadLocal<ResourceLoader>() {
        @Override
        protected ResourceLoader initialValue() {
            return new DefaultResourceLoader();
        }
    };


    public static Resource getResouce(String location) {
        Resource resource = resourceLoaderThreadLocal.get().getResource(location);
        return resource;
    }

}
